package com.itcast.donkey.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itcast.donkey.R;
import com.itcast.donkey.modles.DbAccountModles;

import java.util.List;

/**
 * Created by lanouhn on 16/9/12.
 */
public class ConSumeNotesAdapter extends BaseAdapter {
    private Context context;
    private List<DbAccountModles> modlesList;

    public ConSumeNotesAdapter(Context context, List<DbAccountModles> modlesList) {
        this.context = context;
        this.modlesList = modlesList;
    }

    @Override
    public int getCount() {
        return modlesList.size();
    }

    @Override
    public Object getItem(int position) {
        return modlesList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.item_account_note, null);
        TextView brandName, money, content;
        brandName = (TextView) convertView.findViewById(R.id.tv_brand_name);
        money = (TextView) convertView.findViewById(R.id.tv_item_note_money);
        content = (TextView) convertView.findViewById(R.id.tv_item_note_content);

        brandName.setText(modlesList.get(position).getBrandName());
        money.setText(modlesList.get(position).getPrice());
        content.setText(modlesList.get(position).getContent());

        return convertView;
    }
}
